package com.hu.network.task.impl;

import android.content.Context;

import com.alibaba.fastjson.TypeReference;

import com.hu.network.http.bean.BaseRequestBean;
import com.hu.network.http.bean.InnerRequestBean;
import com.hu.network.http.bean.InnerResponseResult;
import com.hu.network.http.request.IHttpRequest;
import com.hu.network.http.request.impl.JsonGetHttpRequestImpl;
import com.hu.network.task.AbstractTask;

/**
 * 说明：
 *
 * @author ： hucanhua
 * @date ： 2017/10/25
 */
public class SimpleJsonGetTaskImpl<V> extends AbstractTask<V> {

    private final BaseRequestBean requestBean;
    private final TypeReference<V> tTypeReference;

    public SimpleJsonGetTaskImpl(Context context, BaseRequestBean requestBean, boolean useHttps, String url, TypeReference<V> tTypeReference, ITaskCallback<V> iTaskCallback) {
        super(context, useHttps, url, iTaskCallback);
        this.requestBean = requestBean;
        this.tTypeReference = tTypeReference;
    }

    @Override
    protected boolean before(InnerResponseResult<V> innerResponseResult) {
        return true;
    }

    @Override
    protected void after(InnerResponseResult<V> innerResponseResult) {

    }

    @Override
    protected IHttpRequest<V> getRequest() {
        return new JsonGetHttpRequestImpl<>(new InnerRequestBean<>(useHttps, url, requestBean), tTypeReference, null, null);
    }
}
